package org.sgx.dao.test.test1;

import org.sgx.dao.BeanDao;
import org.sgx.dao.ConnectionGiver;
import org.sgx.dao.Dao;
import org.sgx.dao.DaoException;
import org.sgx.dao.model.Model;
import org.sgx.dao.test.test1.testModel.BeanTest1;

public class ManagerTest1 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
//		try {
			System.out.println(Model.class.isAssignableFrom(BeanTest1.class));
//			Dao<BeanTest1> d1 = DaoManager.getInstance().getBeanTest1Dao();
//		} catch (DaoException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
	}
	
	public static class DaoManager {
	private static final String EVENT_TABLE_NAME = "events_event" ,
		PLACE_TABLE_NAME = "events_places";
	private static DaoManager instance;
	private ConnectionGiver cg;

	private DaoManager() {
	}

	public static DaoManager getInstance() {
		if (null == instance) {
			instance = new DaoManager();
		}
		return instance;
	}
	public ConnectionGiver getConnectionGiver() throws DaoException {
		if(cg==null)
			cg= DaoTest1.getValidConnectionGiver();
		return cg;
	}
	public Dao<BeanTest1> getBeanTest1Dao() throws DaoException {
		return new BeanDao<BeanTest1>(getConnectionGiver(), BeanTest1.class, EVENT_TABLE_NAME);
	}
	
	}

}
